package com.glink.manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glink.manage.domain.VehicleInfoBean;
import com.glink.manage.dto.vehicle.VehicleSyncDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface VehicleInfoMapper extends BaseMapper<VehicleInfoBean> {

    /**
     * 根据参建单位和工程查询准入的车牌
     *
     * @param constructionWorkObjId  工程ID
     * @param participatingUnitObjId 参建单位ID
     * @return 准入人员名称
     */
    List<String> findAccessLicensePlateByWorkObjIdAndUnitObjId(String constructionWorkObjId, String participatingUnitObjId, String nowDate);
    
    /**
     * 查询未同步人员信息
     * @param devSno 设备号
     * @param constructionWorkObjId 工程ID
     * @param nowDate 临时车辆准入-当前时间
     * @param admissionType 临时准入类型-车辆
     * @param accessStatus 审批单状态
     * @param temporaryApprovalFormStatus 临时准入，审批单类型
     * @param licensePlateList 车牌号列表
     * @return 车牌准入信息
     */
    List<VehicleSyncDTO> findLicensePlateIdByWorkIdAndNotSyncByTemporary(@Param("devSno") String devSno,
                                                                         @Param("constructionWorkObjId") String constructionWorkObjId,
                                                                         @Param("nowDate") Date nowDate,
                                                                         @Param("admissionType") String admissionType,
                                                                         @Param("accessStatus") String accessStatus,
                                                                         @Param("temporaryApprovalFormStatus") String temporaryApprovalFormStatus,
                                                                         @Param("licensePlateList") List<String> licensePlateList,
                                                                         @Param("limit")  Integer limit);

    /**
     * 查询未同步人员信息
     * @param devSno 设备号
     * @param constructionWorkObjId 工程ID
     * @param nowDate 临时车辆准入-当前时间
     * @param admissionType 临时准入类型-车辆
     * @param accessStatus 审批单状态
     * @param temporaryApprovalFormStatus 临时准入，审批单类型
     * @param licensePlateList 车牌号列表
     * @return 车牌准入信息
     */
    List<VehicleSyncDTO> findLicensePlateIdByWorkIdByTemporary(@Param("devSno") String devSno,
                                                                         @Param("constructionWorkObjId") String constructionWorkObjId,
                                                                         @Param("nowDate") Date nowDate,
                                                                         @Param("admissionType") String admissionType,
                                                                         @Param("accessStatus") String accessStatus,
                                                                         @Param("temporaryApprovalFormStatus") String temporaryApprovalFormStatus,
                                                                         @Param("licensePlateList") List<String> licensePlateList,
                                                                         @Param("sync") boolean sync);
    
    /**
     * 查询未同步人员信息
     * @param devSno 设备号
     * @param orgIdList 组织单位ID
     * @param approvalFormStatus 正式车辆审判单类型
     * @return 车牌准入信息
     */
    List<VehicleSyncDTO> findLicensePlateIdByWorkIdAndNotSyncByDepartment(@Param("devSno") String devSno, @Param("orgIdList") List<String> orgIdList,
                                                                          @Param("approvalFormStatus") String approvalFormStatus,
                                                                          @Param("limit")  Integer limit);

    /**
     * 查询未同步人员信息
     * @param devSno 设备号
     * @param orgIdList 组织单位ID
     * @param approvalFormStatus 正式车辆审判单类型
     * @return 车牌准入信息
     */
    List<VehicleSyncDTO> findLicensePlateIdByWorkIdByDepartment(@Param("devSno") String devSno, @Param("orgIdList") List<String> orgIdList,
                                                                    @Param("approvalFormStatus") String approvalFormStatus,
                                                                    @Param("sync") boolean sync);
    
    /**
     * 查询未同步人员信息
     * @param devSno 设备号
     * @param constructionWorkObjId 工程ID
     * @param nowDate 临时车辆准入-当前时间
     * @param approvalFormStatus 正式车辆审判单类型
     * @return 车牌准入信息
     */
    List<VehicleSyncDTO> findLicensePlateIdByWorkIdAndNotSyncByParticipatingUnit(@Param("devSno") String devSno,
                                                                                 @Param("constructionWorkObjId") String constructionWorkObjId,
                                                                                 @Param("nowDate") Date nowDate,
                                                                                 @Param("approvalFormStatus") String approvalFormStatus,
                                                                                 @Param("limit")  Integer limit);

    /**
     * 查询未同步人员信息
     * @param devSno 设备号
     * @param constructionWorkObjId 工程ID
     * @param nowDate 临时车辆准入-当前时间
     * @param approvalFormStatus 正式车辆审判单类型
     * @return 车牌准入信息
     */
    List<VehicleSyncDTO> findLicensePlateIdByWorkIdByParticipatingUnit(@Param("devSno") String devSno,
                                                                            @Param("constructionWorkObjId") String constructionWorkObjId,
                                                                            @Param("nowDate") Date nowDate,
                                                                            @Param("approvalFormStatus") String approvalFormStatus,
                                                                            @Param("sync") boolean sync);
}
